package com.chunxuan.langquan.support.util;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Base64;

/**
 * Bitmap工具栏
 */
public class BitmapUtil {
    /**
     * Base64字符串转为Bitmap
     * @param string
     * @return
     */
    public static Bitmap stringtoBitmap(String string){
        //将字符串转换成Bitmap类型
        Bitmap bitmap=null;
        try {
            byte[] bitmapArray;
            bitmapArray= Base64.decode(string, Base64.DEFAULT);
            String pic=new String(bitmapArray);
            Logg.e("==base64图片=="+pic);
            bitmap= BitmapFactory.decodeByteArray(bitmapArray, 0, bitmapArray.length);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return bitmap;
    }
}
